﻿// --------------------------------------------------------------------------------------------------------------------
// <copyright file="Region.cs" company="DissingNelleman">
//   
// All rights reserved. </copyright>
// <summary>
//   The region.
// </summary>
// --------------------------------------------------------------------------------------------------------------------

namespace ServiceLibrary.Models.Domain
{
    using NHibernate.Mapping.ByCode.Conformist;

    using ServiceLibrary.Models.Base;

    /// <summary>
    /// The region.
    /// </summary>
    public class Region : Entity
    {
        #region Public Properties

        /// <summary>
        /// Gets or sets the additional information.
        /// </summary>
        public virtual string AdditionalInformation { get; set; }

        /// <summary>
        /// Gets or sets the country.
        /// </summary>
        public virtual Country Country { get; set; }

        /// <summary>
        /// Gets or sets the name.
        /// </summary>
        public virtual string Name { get; set; }

        #endregion
    }

    /// <summary>
    /// The region mapping.
    /// </summary>
    public class RegionMapping : ClassMapping<Region>
    {
        #region Constructors and Destructors

        /// <summary>
        /// Initializes a new instance of the <see cref="RegionMapping"/> class.
        /// </summary>
        public RegionMapping()
        {
            this.Property(x => x.Name);
            this.Property(x => x.AdditionalInformation, m => m.Length(int.MaxValue / 2));

            this.ManyToOne(x => x.Country);
        }

        #endregion
    }
}